package com.xzc.datastruc.ujava.c07._1_introduction;

public class Fibonacci {
    static long i = 0;
    /**
     * Compute the Nth Fibonacci number
     * Bad algorithm fib(400) can't solved
     */
    public static long fib(int n) {
        i++;
        if (n <= 1)
            return n;
        else
            return fib(n - 1) + fib(n - 2);
    }

    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        long fnth = fib(40);
        System.out.println(i);
        System.out.println(System.currentTimeMillis() - start);
    }
}
